fix: delegate ShouldInterceptRequest in DevFlowWebViewClient#102
Merged
Conversation
DevFlowWebViewClient replaces MAUI's WebKitWebViewClient on Android but was not delegating ShouldInterceptRequest to the inner client. This broke local asset serving for all Blazor Hybrid apps because MAUI's ShouldInterceptRequest is the mechanism that serves wwwroot/ assets via the https://0.0.0.1/ custom scheme. Without this delegation, all CSS and JS asset requests fail (the base WebViewClient returns null = 'don't intercept'), Blazor never initializes, and the app is stuck on the loading screen. Fixes #101 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Android Blazor Hybrid asset loading regressions introduced by DevFlowWebViewClient by delegating ShouldInterceptRequest to MAUI’s original inner WebViewClient, allowing MAUI’s https://0.0.0.1/ asset interception to work as intended.
Changes:
- Add
ShouldInterceptRequestoverride inDevFlowWebViewClientthat delegates to the existing inner client (falling back to base). - Preserve existing delegation pattern already used for
ShouldOverrideUrlLoading.
Redth
approved these changes
Apr 19, 2026
|
No documentation updates needed — this is an internal bug fix (delegating
|
PureWeen
added a commit
to PureWeen/PolyPilot
that referenced
this pull request
Apr 20, 2026
…OS & Android (#639) ## Summary Fixes the session context menu (⋯ button) on mobile devices. The menu was completely unusable on both iOS and Android — tapping ⋯ switched sessions, the menu couldn't scroll, and the keyboard appeared unexpectedly. ## Changes ### DevFlow Revert - **Reverted MauiDevFlow.Blazor to preview.4** — preview.5 breaks BlazorWebView asset serving on Android (missing `ShouldInterceptRequest` delegation). Filed [dotnet/maui-labs#101](dotnet/maui-labs#101) and [PR #102](dotnet/maui-labs#102). ### ⋯ Button Session Selection Fix - **Root cause**: A capture-phase JS click handler in `index.html` called `JsExpandSession` on ANY click inside a `.session-item`, including ⋯ button and menu items. This switched sessions on every menu interaction. - **Fix**: Added early return for `.more-btn`, `.session-menu`, and `.menu-overlay` clicks. - Moved `@onclick` from `session-item` to `session-info` div so the ⋯ button area is structurally excluded. ### iOS Ghost Click Prevention - On iOS, tapping ⋯ caused a ghost touch on the `flyout-backdrop` behind the menu overlay. A capture-phase JS handler now blocks backdrop events within 1s of a menu interaction via `stopImmediatePropagation`. ### iOS Keyboard Dismissal - `ToggleFlyout` now calls `activeElement.blur()` to dismiss the keyboard when the flyout opens. - `positionSessionMenu` also blurs on menu open. - Added `user-select: none !important` on `.menu-item` to prevent iOS WebKit from treating `all: unset` buttons as editable. ### Menu Scroll (iOS & Android) - **Portal to body**: On mobile, `positionSessionMenu` moves the menu DOM to `document.body` to escape the flyout's CSS `transform` stacking context. iOS WebKit cannot natively scroll `position: fixed` elements inside a transformed parent. - **Safe area insets**: Menu `maxHeight` now probes `env(safe-area-inset-top/bottom)` on iOS (via temp element) and reads `--nav-bar-height`/`--status-bar-height` on Android. - **Freeze parent scroll**: Flyout and session-list `overflow` set to `hidden` while menu is open; restored via `MutationObserver` on menu removal. ## Testing - Verified on physical Samsung S24 (Android) via ADB real taps + DevFlow CDP - Verified on physical iPhone 15 Pro Max (iOS) via MauiDevFlow CDP - Mac Catalyst builds clean (no regression) ## Files Changed - `PolyPilot/wwwroot/index.html` — JS capture handlers, positionSessionMenu portal + safe area - `PolyPilot/Components/Layout/SessionListItem.razor` — moved onclick, simplified handlers - `PolyPilot/Components/Layout/SessionListItem.razor.css` — menu scroll CSS - `PolyPilot/Components/Layout/MainLayout.razor` — flyout keyboard dismiss, backdrop guard - `PolyPilot/PolyPilot.csproj` — DevFlow revert to preview.4 - `PolyPilot.Gtk/PolyPilot.Gtk.csproj` — DevFlow revert to preview.4 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DevFlowWebViewClient(added in 2c05e68) replaces MAUI'sWebKitWebViewClienton Android to detect page navigation and re-inject chobitsu. However, it only delegatesOnPageFinishedandShouldOverrideUrlLoading— it does not delegateShouldInterceptRequest.MAUI's
WebKitWebViewClient.ShouldInterceptRequest()is the mechanism that serves localwwwroot/assets (CSS, JS, images) via thehttps://0.0.0.1/custom scheme. Without delegation, the baseWebViewClientreturnsnull("don't intercept"), so all asset requests fail — the WebView tries to fetch from0.0.0.1over the network, which doesn't exist.Symptoms
index.htmlloads (served separately asHostPage) but all CSS/JS faildocument.styleSheets.length === 0,typeof Blazor === "undefined"AddMauiBlazorDevFlowTools()on AndroidAffected versions
0.1.0-preview.4.26202.30.1.0-preview.5.26217.12Fix
Add
ShouldInterceptRequestoverride that delegates to the inner client, matching the existing pattern used forShouldOverrideUrlLoading.Fixes #101